package com.wft.singleton;

public class Test02DoubleCheck {
    private static volatile Test02DoubleCheck instance;

    private Test02DoubleCheck() {
    }

    public static Test02DoubleCheck getInstance() {
        if(instance == null){
//            synchronized (Test02DoubleCheck.class){
                if(instance == null){
                    instance = new Test02DoubleCheck();
//                }
            }
        }
        return instance;
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        System.out.println(Test02DoubleCheck.getInstance());
        System.out.println(Test02DoubleCheck.getInstance());


        Test02DoubleCheck doubleCheck = Test02DoubleCheck.class.newInstance();
        System.out.println(doubleCheck);
    }
}
